import React from 'react'
import '@/pages/index.less'
import WebIndex from '@/components/WebIndex'
import MobileIndex from '@/components/MobileIndex'
import ReactGA from 'react-ga'
ReactGA.initialize('UA-134997102-1')
ReactGA.pageview('home')
export default class extends React.Component {
  static async getInitialProps({ query, mobxStore, req, asPath }) {
    const header = req.headers
    return { header }
  }
  render() {
    const header = this.props.header
    let platform = 'm'
    if (!/iphone|android|ipod|ipad/i.test(header['user-agent'].toLocaleLowerCase())) {
      platform = 'pc'
    }
    if (platform === 'm') {
      return (
        <MobileIndex />
      )
    } else {
      return (
        <WebIndex />
      )
    }
  }
}
